package cn.com.headfree.technician.service.impl;

import java.util.ArrayList;
import java.util.List;

import cn.com.headfree.entity.*;
import cn.com.headfree.technician.dao.IUserDataInfoDao;
import cn.com.headfree.technician.service.IUserDataInfoService;
import cn.com.headfree.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;


@Service("userDataInfoService")
public class UserDataInfoServiceImpl implements IUserDataInfoService {
	@Autowired
	private IUserDataInfoDao userInfoDao;

	/**
	 * 基本信息
	 * @param erpNo
	 * @return
	 */
	@Override
	public TEmpBaseInfo getBaseInfoByErpNo(String erpNo) {
		return userInfoDao.getBaseInfoByErpNo(erpNo);
	}

	/**
	 * 年度绩效
	 * @param erpNo
	 */
	public List<TYearEffectInfo> getYearEffectByErpNo(String erpNo){
		return userInfoDao.getYearEffectByErpNo(erpNo);
	}


	/**
	 * 专业技术资格
	 * @param erpNo
	 */
	@Override
	public List<HonorDatasVo> getProTecInfoByErpNo(String erpNo,String seniorId) {
		return userInfoDao.getProTecInfoByErpNo(erpNo,seniorId);
	}

	/**
	 * 技能等级
	 * @param erpNo
	 */
	@Override
	public List<HonorDatasVo> getSkillLevelInfoByErpNo(String erpNo,String seniorId) {
		return userInfoDao.getSkillLevelInfoByErpNo(erpNo,seniorId);
	}


	/**
	 * 专家人才称号
	 * @param erpNo
	 */
	@Override
	public List<HonorDatasVo> getExpertTitleInfoByErpNo(String erpNo,String seniorId) {
		return userInfoDao.getExpertTitleInfoByErpNo(erpNo,seniorId);
	}

	/**
	 * 学术成果
	 * @param erpNo
	 */
	@Override
	public List<StandAndScienceVo> getAcadeAchiveInfoByErpNo(String erpNo,String seniorId) {
		return userInfoDao.getAcadeAchiveInfoByErpNo(erpNo,seniorId);
	}
	/**
	 * 标准制定
	 * @param erpNo
	 */
	@Override
	public List<StandAndScienceVo> getStandInfoByErpNo(String erpNo,String seniorId) {
		return userInfoDao.getStandInfoByErpNo(erpNo,seniorId);
	}
	/**
	 * 专利信息
	 * @param erpNo
	 */
	@Override
	public List<SkillAndTechnicalVo> getPatentInfoByErpNo(String erpNo,String seniorId) {
		return userInfoDao.getPatentInfoByErpNo(erpNo,seniorId);
	}
	/**
	 * 技艺革新
	 * @param erpNo
	 */
	@Override
	public List<SkillAndTechnicalVo> getTecInnovInfoByErpNo(String erpNo,String seniorId) {
		return userInfoDao.getTecInnovInfoByErpNo(erpNo,seniorId);
	}
	/**
	 * 竞赛考试
	 * @param erpNo
	 */
	@Override
	public List<ContestInfoVo> getContestInfoByErpNo(String erpNo,String seniorId) {
		return userInfoDao.getContestInfoByErpNo(erpNo,seniorId);
	}

	/**
	 * 科技创新成果
	 * @param erpNo
	 */
	@Override
	public List<SkillAndTechnicalVo> getTecManInnovByErpNo(String erpNo,String seniorId) {
		return  userInfoDao.getTecManInnovByErpNo(erpNo,seniorId);
	}

	/**
	 * 个人荣誉
	 * @param erpNo
	 */
	@Override
	public List<HonorDatasVo> getHonnorInfoByErpNo(String erpNo,String seniorId) {
		return userInfoDao.getHonnorInfoByErpNo(erpNo,seniorId);
	}

	/**
	 * 工作经历
	 * @param erpNo
	 */
	@Override
	public List<WorkExpInfoVo> getWorkExpInfoByErpNo(String erpNo,String seniorId) {
		return userInfoDao.getWorkExpInfoByErpNo(erpNo,seniorId);
	}

	/**
	 * 学历信息
	 * @param erpNo
	 */
	@Override
	public List<StudyAndTrainVo> getEducateInfoByErpNo(String erpNo,String seniorId) {
		return userInfoDao.getEducateInfoByErpNo(erpNo,seniorId);
	}

	/**
	 * 培训授课--培训部分
	 * @param erpNo
	 */
	@Override
	public List<StudyAndTrainVo> getContiStudyInfoByErpNo(String erpNo,String seniorId) {
		return userInfoDao.getContiStudyInfoByErpNo(erpNo,seniorId);
	}

	//培训授课--授课部分
    @Override
    public List<TeachArtVo> getContiStudyTechInfoByErpNo(String erpNo,String seniorId) {
        return userInfoDao.getContiStudyTechInfoByErpNo(erpNo,seniorId);
    }

    /**
	 * 项目课题成果
	 * @param erpNo
	 */
	@Override
	public List<SkillAndTechnicalVo> getProjAchieveInfoByErpNo(String erpNo,String seniorId) {
		return userInfoDao.getProjAchieveInfoByErpNo(erpNo,seniorId);
	}

    @Override
    public List<TeachArtVo> getTSdtTutorPrentInfoByErpNo(String erpNo,String seniorId) {
        return userInfoDao.getTSdtTutorPrentInfoByErpNo(erpNo,seniorId);
    }

	@Override
	public TSeniorTechnician getTSeniorTechnicianById(String seniorId) {
		return userInfoDao.getTSeniorTechnicianById(seniorId);
	}

	/**
	 * 组合各类型ID，以下载附件
	 * @param erpNo
	 * @return
	 */
	@Override
	public List<BusinessIdsVo> getBusinessIdByErpNo(String erpNo,String seniorId) {
		List<BusinessIdsVo> list = new ArrayList<>();
		//基本信息
		TEmpBaseInfo baseInfo = getBaseInfoByErpNo(erpNo);
		if(baseInfo != null){
			BusinessIdsVo vo = new BusinessIdsVo();
			vo.setBusinessId(baseInfo.getId());
			vo.setTypeName("基本信息");
			list.add(vo);
		}
		//工作经历
		List<WorkExpInfoVo> tWorkExpInfos = getWorkExpInfoByErpNo(erpNo,seniorId);
		if(tWorkExpInfos != null){
			for (WorkExpInfoVo workExpInfoVo:tWorkExpInfos){
				if(workExpInfoVo.getIsHide() == null || !(workExpInfoVo.getIsHide().equals("0"))){
					BusinessIdsVo vo = new BusinessIdsVo();
					vo.setBusinessId(workExpInfoVo.getId());
					vo.setTypeName("工作经历");
					list.add(vo);
				}
			}
		}
		//学历、培训
		List<StudyAndTrainVo> educateInfos = getEducateInfoByErpNo(erpNo,seniorId);
		if(educateInfos != null){
			for (StudyAndTrainVo studyAndTrainVo:educateInfos){
				if(studyAndTrainVo.getIsHide() == null || !(studyAndTrainVo.getIsHide().equals("0"))) {
					BusinessIdsVo vo = new BusinessIdsVo();
					vo.setBusinessId(studyAndTrainVo.getId());
					vo.setTypeName("学历信息");
					list.add(vo);
				}
			}
		}
		List<StudyAndTrainVo> studyInfos = getContiStudyInfoByErpNo(erpNo,seniorId);
		if(studyInfos != null){
			for (StudyAndTrainVo studyAndTrainVo:studyInfos){
				if(studyAndTrainVo.getIsHide() == null || !(studyAndTrainVo.getIsHide().equals("0"))) {
					BusinessIdsVo vo = new BusinessIdsVo();
					vo.setBusinessId(studyAndTrainVo.getId());
					vo.setTypeName("培训授课");
					list.add(vo);
				}
			}
		}
		//技艺革新
		List<SkillAndTechnicalVo> skillAndTechnicalVos = getTecInnovInfoByErpNo(erpNo,seniorId);
		if(skillAndTechnicalVos != null){
			for (SkillAndTechnicalVo skillAndTechnicalVo:skillAndTechnicalVos){
				if(skillAndTechnicalVo.getIsHide() == null || !(skillAndTechnicalVo.getIsHide().equals("0"))) {
					BusinessIdsVo vo = new BusinessIdsVo();
					vo.setBusinessId(skillAndTechnicalVo.getId());
					vo.setTypeName("技艺革新");
					list.add(vo);
				}
			}
		}
		//专利
		List<SkillAndTechnicalVo> patentInfos = getPatentInfoByErpNo(erpNo,seniorId);
		if(patentInfos != null){
			for (SkillAndTechnicalVo skillAndTechnicalVo:patentInfos){
				if(skillAndTechnicalVo.getIsHide() == null || !(skillAndTechnicalVo.getIsHide().equals("0"))) {
					BusinessIdsVo vo = new BusinessIdsVo();
					vo.setBusinessId(skillAndTechnicalVo.getId());
					vo.setTypeName("专利信息");
					list.add(vo);
				}
			}
		}
		//科技创新
		List<SkillAndTechnicalVo> tecManInnovs = getTecManInnovByErpNo(erpNo,seniorId);
		if(tecManInnovs != null){
			for (SkillAndTechnicalVo skillAndTechnicalVo:tecManInnovs){
				if(skillAndTechnicalVo.getIsHide() == null || !(skillAndTechnicalVo.getIsHide().equals("0"))) {
					BusinessIdsVo vo = new BusinessIdsVo();
					vo.setBusinessId(skillAndTechnicalVo.getId());
					vo.setTypeName("科技创新管理");
					list.add(vo);
				}
			}
		}
		//项目成果
		List<SkillAndTechnicalVo> projAchieveInfos = getProjAchieveInfoByErpNo(erpNo,seniorId);
		if(projAchieveInfos != null){
			for (SkillAndTechnicalVo skillAndTechnicalVo:projAchieveInfos){
				if(skillAndTechnicalVo.getIsHide() == null || !(skillAndTechnicalVo.getIsHide().equals("0"))) {
					BusinessIdsVo vo = new BusinessIdsVo();
					vo.setBusinessId(skillAndTechnicalVo.getId());
					vo.setTypeName("项目课题成果");
					list.add(vo);
				}
			}
		}
		//标准制定
		List<StandAndScienceVo> standAndSciences = getStandInfoByErpNo(erpNo,seniorId);
		if(standAndSciences != null){
			for (StandAndScienceVo standAndScienceVo:standAndSciences){
				if(standAndScienceVo.getIsHide() == null || !(standAndScienceVo.getIsHide().equals("0"))) {
					BusinessIdsVo vo = new BusinessIdsVo();
					vo.setBusinessId(standAndScienceVo.getId());
					vo.setTypeName("标准制定");
					list.add(vo);
				}
			}
		}
		//学术成果
		List<StandAndScienceVo> acadeAchiveInfos = getAcadeAchiveInfoByErpNo(erpNo,seniorId);
		if(acadeAchiveInfos != null){
			for (StandAndScienceVo standAndScienceVo:acadeAchiveInfos){
				if(standAndScienceVo.getIsHide() == null || !(standAndScienceVo.getIsHide().equals("0"))) {
					BusinessIdsVo vo = new BusinessIdsVo();
					vo.setBusinessId(standAndScienceVo.getId());
					vo.setTypeName("学术成果");
					list.add(vo);
				}
			}
		}
		//竞赛考试
		List<ContestInfoVo> tContestInfos = getContestInfoByErpNo(erpNo,seniorId);
		if(tContestInfos != null){
			for (ContestInfoVo contestInfoVo:tContestInfos){
				if(contestInfoVo.getIsHide() == null || !(contestInfoVo.getIsHide().equals("0"))) {
					BusinessIdsVo vo = new BusinessIdsVo();
					vo.setBusinessId(contestInfoVo.getId());
					vo.setTypeName("竞赛考试");
					list.add(vo);
				}
			}
		}
		//师带徒信息
		List<TeachArtVo> tSdtTutorPrentInfos = getTSdtTutorPrentInfoByErpNo(erpNo,seniorId);
		if(tSdtTutorPrentInfos != null){
			for (TeachArtVo teachArtVo:tSdtTutorPrentInfos){
				if(teachArtVo.getIsHide() == null || !(teachArtVo.getIsHide().equals("0"))) {
					BusinessIdsVo vo = new BusinessIdsVo();
					vo.setBusinessId(teachArtVo.getId());
					vo.setTypeName("师带徒信息");
					list.add(vo);
				}
			}
		}
		//培训授课
		List<TeachArtVo> contiInfos = getContiStudyTechInfoByErpNo(erpNo,seniorId);
		if(contiInfos != null){
			for (TeachArtVo teachArtVo:contiInfos){
				if(teachArtVo.getIsHide() == null || !(teachArtVo.getIsHide().equals("0"))) {
					BusinessIdsVo vo = new BusinessIdsVo();
					vo.setBusinessId(teachArtVo.getId());
					vo.setTypeName("培训授课");
					list.add(vo);
				}
			}
		}
		//个人荣誉
		List<HonorDatasVo> honnorInfos = getHonnorInfoByErpNo(erpNo,seniorId);
		if(honnorInfos != null){
			for (HonorDatasVo honorDatasVo:honnorInfos){
				if(honorDatasVo.getIsHide() == null || !(honorDatasVo.getIsHide().equals("0"))) {
					BusinessIdsVo vo = new BusinessIdsVo();
					vo.setBusinessId(honorDatasVo.getId());
					vo.setTypeName("个人荣誉");
					list.add(vo);
				}
			}
		}
		//专家人才称号
		List<HonorDatasVo> expertTitleInfos = getExpertTitleInfoByErpNo(erpNo,seniorId);
		if(expertTitleInfos != null){
			for (HonorDatasVo honorDatasVo:expertTitleInfos){
				if(honorDatasVo.getIsHide() == null || !(honorDatasVo.getIsHide().equals("0"))) {
					BusinessIdsVo vo = new BusinessIdsVo();
					vo.setBusinessId(honorDatasVo.getId());
					vo.setTypeName("专家人才称号");
					list.add(vo);
				}
			}
		}
		//专业技术资格
		List<HonorDatasVo> proTecInfos = getProTecInfoByErpNo(erpNo,seniorId);
		if(proTecInfos != null){
			for (HonorDatasVo honorDatasVo:proTecInfos){
				if(honorDatasVo.getIsHide() == null || !(honorDatasVo.getIsHide().equals("0"))) {
					BusinessIdsVo vo = new BusinessIdsVo();
					vo.setBusinessId(honorDatasVo.getId());
					vo.setTypeName("专业技术资格");
					list.add(vo);
				}
			}
		}
		//技能等级
		List<HonorDatasVo> skillLevelInfos = getSkillLevelInfoByErpNo(erpNo,seniorId);
		if(skillLevelInfos != null){
			for (HonorDatasVo honorDatasVo:skillLevelInfos){
				if(honorDatasVo.getIsHide() == null || !(honorDatasVo.getIsHide().equals("0"))) {
					BusinessIdsVo vo = new BusinessIdsVo();
					vo.setBusinessId(honorDatasVo.getId());
					vo.setTypeName("技能等级");
					list.add(vo);
				}
			}
		}
		return list;
	}

	@Override
	public List<TEducateInfo> getEducateInfoHighEducByErpNo(String erpNo) {
		return userInfoDao.getEducateInfoHighEducByErpNo(erpNo);
	}

}
